require 'View/UIBase/UIBase'
require "Common/define"
require "Logic/Config"
require "Common/functions"
local UIGuildFlagSkin = require "View/UIGuild/Skin/UIGuildFlagSkin"

UIGuildFlag = UIBase.New(PanelNames.UIGuildFlag);

function UIGuildFlag.Init(selFlagIdx,func)
    UIGuildFlag.selFlagIdx = selFlagIdx;
    UIBase.Init(UIGuildFlag, func);
end

---@param obj GComponent
function UIGuildFlag:OnCreate()
    print("UIGuildFlag:OnCreate")
    self.viewSkin = UIGuildFlagSkin.New(self.fguiObj,self.selFlagIdx);
    self.viewSkin:setCloseCallback(self.OnBack,self);
end

function UIGuildFlag:OnBack()
    if type(self.backFunc) == "function" then
        self.backFunc(self.viewSkin.seledFlagIndex);
    end
    self.backFunc = nil;
    DestoryUI(self._panelName)
end

function UIGuildFlag:OnDestroy()
    self.viewSkin:OnDestroy();
end

return UIGuildFlag;